package com.xk._04regEx;


import java.util.regex.Pattern;

/**
 * @description: 演示 Pattern.matches(String regex, CharSequence input)方法，用于整体匹配，在验证输入的字符串是否满足条件使用
 * @author: xu
 * @date: 2022/11/2 11:06
 */
public class PatternMethod {
    public static void main(String[] args) {
        String content = "abchello abc hello, 韩顺平教育";
        String regStr = ".*hello.*";
        boolean matches = Pattern.matches(regStr, content);
        System.out.println(matches);
    }

    /*
    * Pattern.matches方法源码：
    * public static boolean matches(String regex, CharSequence input) {
    *     Pattern p = Pattern.compile(regex);
    *     Matcher m = p.matcher(input);
    *     return m.matches();
    * }
    * */
}
